<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String ctx = request.getContextPath();
    request.setAttribute("ctx", ctx);
%>
<html>
<head>
    <title>Title</title>
   <script src="${ctx}/bootstrap/jquery-1.9.1.min.js"></script>
    <script src="${ctx}/bootstrap/jquery.validate.min.js"></script>
    <script src="${ctx}/bootstrap/messages_zh.js"></script>
    <script src="${ctx}/bootstrap/validate.js"></script>

    <link rel="stylesheet" href="${ctx}/css/index_work.css">
</head>
<body>
<form>
    用户名：<input type="text" name="user_name" required class="mobile">
    密码：<input type="password" name="user_password" required>
    <input type="button" value="登录" onclick="login()">
</form>
<script>
    function login() {
       let valid = $("form").valid();
       $.post("${ctx}/login.do",$("form").serialize(),function (res) {
            if(res){
                location.href="${ctx}/list.do";
            }else{
                alert("登录失败");
            }
       })

    }
</script>
</body>
</html>
